/**
 * 用户相关请求
 */

import request from "./request";


const api = '/api/user/userinfo/'


// 登录
export const login = data => {
  return request({
    method: 'POST', 
    url:'/api/user/login/',
    data
  })
};

// 注册
export const register = data => {
  return request({
    method: 'POST',
    url: '/api/user/register',
    data
  })
}

// 获取用户信息
export const getUserInfo = params => {
  return request({
    method: 'get',
    url: api,
    params
  })
}

// 新增用户信息
export const addUserInfo = data => {
  return request({
    method: 'post',
    url: api,
    data
  })
}

// 更新用户信息
export const updateUserInfo = data => {
  return request({
    method: 'patch',
    url: api,
    data
  })
}

// 删除用户信息
export const deleteUserInfo = params => {
  return request({
    method: 'delete',
    url: api,
    params
  })
}

// 更新用户状态
export const updateStatus = data => {
  return request({
    method: 'post',
    url: api + 'update_status/',
    data
  })
}

// 获取用户所属项目
export const getUserProject = params => {
  return request({
    method: 'get',
    url: api + 'get_user_project/',
    params
  })
}
